/*
 * @Author: your name
 * @Date: 2021-10-17 19:26:58
 * @LastEditTime: 2021-10-17 20:11:41
 * @LastEditors: your name
 * @Description: In User Settings Edit
 * @FilePath: \bigdate\src\views\admin\functionPage\jsoneditor\component\codemirror.ts
 */
import CodeMirror from 'codemirror/lib/codemirror'

import 'codemirror/mode/python/python'
import 'codemirror/mode/sql/sql'
import 'codemirror/mode/xml/xml'
import 'codemirror/mode/css/css'
import 'codemirror/mode/jsx/jsx'
import 'codemirror/mode/vue/vue'
import 'codemirror/mode/php/php'
import 'codemirror/mode/textile/textile'
import 'codemirror/mode/shell/shell'
import 'codemirror/mode/javascript/javascript'
// 主题样式引入
import 'codemirror/lib/codemirror.css'
import 'codemirror/theme/ambiance.css'
import 'codemirror/theme/yeti.css'
import 'codemirror/theme/ayu-dark.css'
import 'codemirror/theme/lesser-dark.css'
import 'codemirror/addon/hint/show-hint.css'

export default (id:string, o) => CodeMirror.fromTextArea(document.getElementById(id), { lineNumbers: true,
    theme: 'yeti',
    readOnly: true,
    ...o })
